home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: bath.ac.uk!bsmail!talisker!nathan
- From: nathan@pact.srf.ac.uk (Nathan Sidwell)
- Subject: Re: casting 'char **' to 'const char**'
- Message-ID: <DooHvE.1Gq@uns.bris.ac.uk>
- Sender: usenet@uns.bris.ac.uk (Usenet news owner)
- Nntp-Posting-Host: talisker.pact.srf.ac.uk
- Organization: Inmos
- X-Newsreader: TIN [version 1.2 PL2]
- References: <827329986.5426@redifon.demon.co.uk>
- Date: Fri, 22 Mar 1996 16:59:37 GMT
-
- Guy Pickering (gp@redifon.demon.co.uk) wrote:
- : While my compiler is happy with me passing a 'char*' to a function
- : requiring a 'const char*', it is not happy about passing a 'char**'
- : to a function expecting a 'const char**'. I cannot seem to find any
- : refs to this in K&R. What is the correct behaviour?
- K&R wouldn't help because const only became standardized with ANSI
- You need K&R2 or the ansi standard.
-
- Your compiler is correct, it is safe to silently convert
- a T * to a T const *, but not to convert a T ** to a T const **.
- Why? see the FAQ 4.<something>
-
- nathan
-
-
- --
- Nathan Sidwell Holder of the Xmris home page
- Chameleon Architecture Group at SGS-Thomson, formerly Inmos
- http://www.pact.srf.ac.uk/~nathan/ Tel 0117 9707182
- nathan@inmos.co.uk or nathan@bristol.st.com or nathan@pact.srf.ac.uk
-